package com.guoheng.safe.sys.controller;

import com.guoheng.safe.common.base.Result;
import com.guoheng.safe.sys.dto.IdDTO;
import com.guoheng.safe.sys.dto.basicinfo.ProductionPlaceAddDTO;
import com.guoheng.safe.sys.dto.basicinfo.ProductionPlacePageDTO;
import com.guoheng.safe.sys.dto.basicinfo.ProductionPlaceUpdateDTO;
import com.guoheng.safe.sys.service.ProductionPlaceService;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 类功能描述:　BasicController
 *
 * @author Eternal
 * @date 2019-56-15 14:56
 */
@RestController
@Validated
@Api(value = "生产场所")
public class ProductionPlaceController {

    @Resource
    ProductionPlaceService productionPlaceService;

    @PostMapping(value = "basic/place/add")
    public Result addProductionPlace(@RequestBody @Valid ProductionPlaceAddDTO productionPlaceAddDTO){
        return productionPlaceService.addProductionPlace(productionPlaceAddDTO);
    }

    @PostMapping(value = "basic/place/update")
    public Result updateProductionPlace(@RequestBody @Valid ProductionPlaceUpdateDTO productionPlaceUpdateDTO){
        return productionPlaceService.updateProductionPlace(productionPlaceUpdateDTO);
    }

    @PostMapping(value = "basic/place/delete")
    public Result deleteProductionPlace(@RequestBody @Valid IdDTO idDTO){
        return productionPlaceService.deleteProductionPlace(idDTO);
    }

    @PostMapping(value = "basic/place/query")
    public Result getProductionPlace(@RequestBody @Valid IdDTO idDTO){
        return productionPlaceService.getProductionPlace(idDTO);
    }

    @PostMapping(value = "basic/place/page")
    public Result getProductionPlaces(@RequestBody @Valid ProductionPlacePageDTO pageDTO){
        return productionPlaceService.getProductionPlacePage(pageDTO);
    }

}
